package com.oba.king.hospitalinfo.doccolinformation;

import java.util.List;

import com.oba.base.dao.BaseDao;
import com.oba.base.interfaces.IHsqlBuilder;
import com.oba.base.service.BaseBo;
import com.oba.king.hospitalinfo.hospitalinformation.HospitalInformation;

public class DoccolInformationDao extends BaseDao {

	public IHsqlBuilder buildAll() {
		IHsqlBuilder sql = this.getSqlBuilder("from DoccolInformation doccol");
		sql.addend("order by doccol.sectionName");
		return sql;
	}

	public IHsqlBuilder srchBySectionName(String sectionName) {
		IHsqlBuilder sql = getSqlBuilder("from DoccolInformation docc");
		sql.add("docc.sectionName like ?", sectionName, "%", "%");
		sql.addend("order by docc.sectionName");
		return sql;
	}

	public List<HospitalInformation> buildAllHospital() {
		return find("from HospitalInformation hospital");
	}

	// 模糊查询
	public IHsqlBuilder srchByCondition(DoccolCondition doccolCondition) {
		IHsqlBuilder sql = getSqlBuilder("from DoccolInformation docc");
		sql.add("docc.sectionName like ?", doccolCondition.getSectionName().trim(), "%", "%");
		sql.add("docc.hospitalInformation.hospitalName like ?", doccolCondition.getHospitalName().trim(), "%", "%");
		sql.add("docc.hospitalInformation.cityName =?", doccolCondition.getCityName().trim());
		sql.addend("order by docc.sectionName");
		return sql;
	}

}
